package com.sas.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

import org.springframework.util.Assert;
/**
 * Article with vendor's code
 * @author xin
 *
 */
@Entity
public class ArticleOfVendorCode extends PersistentEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6732430735191009388L;

	@Column(nullable = false)
	private String articleCodeOfVendor;
	
	@OneToOne (cascade = CascadeType.ALL)
	@JoinColumn(name = "articleVendorId")
	private Article article;
	
	ArticleOfVendorCode () {
	}

	public String getArticleCodeOfVendor() {
		return articleCodeOfVendor;
	}

	public void setArticleCodeOfVendor(String articleCodeOfVendor) {
		Assert.hasText(articleCodeOfVendor);
		this.articleCodeOfVendor = articleCodeOfVendor;
	}

	public Article getArticle() {
		return article;
	}

	public void setArticle(Article article) {
		Assert.notNull(article);
		this.article = article;
	}
	
	
	
}
